//
//  LaunchConfig.swift
//  CMB250716
//
//  Created by Assistant on 2025-01-11.
//

import Foundation

/// 启动性能配置
struct LaunchConfig {
    
    // MARK: - 启动时间配置
    
    /// 启动画面最小显示时间（秒）- 优化为快速启动
    static let minimumSplashDuration: TimeInterval = 0.2
    
    /// 启动画面最大显示时间（秒）- 防止无限等待
    static let maximumSplashDuration: TimeInterval = 2.0
    
    /// 数据加载超时时间（秒）- 从5秒优化为2秒
    static let dataLoadingTimeout: TimeInterval = 2.0
    
    /// 数据加载完成后的过渡延时（秒）- 从0.3秒优化为0.1秒
    static let dataLoadingTransitionDelay: TimeInterval = 0.1
    
    /// Logo动画持续时间（秒）- 从1.0秒优化为0.5秒
    static let logoAnimationDuration: TimeInterval = 0.5
    
    /// 启动画面淡出动画时间（秒）
    static let splashFadeOutDuration: TimeInterval = 0.3
    
    // MARK: - 数据预加载配置
    
    /// 是否启用数据预加载
    static let enableDataPreloading: Bool = true
    
    /// 预加载优先级数据类型
    static let preloadPriority: [DataType] = [.menuItems, .coupons, .userProfile]
    
    /// 是否在后台线程预加载数据
    static let useBackgroundPreloading: Bool = true
    
    // MARK: - 启动优化配置
    
    /// 是否启用快速启动模式
    static let enableFastLaunch: Bool = true
    
    /// 是否跳过非关键初始化
    static let skipNonCriticalInit: Bool = true
    
    /// 是否延迟加载非必要组件
    static let enableLazyLoading: Bool = true
    
    /// 启动完成后延迟加载的组件
    static let lazyLoadComponents: [ComponentType] = [.socialMedia, .analytics, .notifications]
    
    // MARK: - 动画配置
    
    /// 启动动画配置
    struct Animation {
        /// Logo缩放起始值
        static let logoInitialScale: CGFloat = 0.9
        
        /// Logo缩放结束值
        static let logoFinalScale: CGFloat = 1.0
        
        /// Logo透明度起始值
        static let logoInitialOpacity: Double = 0.3
        
        /// Logo透明度结束值
        static let logoFinalOpacity: Double = 1.0
        
        /// 是否启用弹性动画
        static let useSpringAnimation: Bool = false
        
        /// 动画曲线类型
        static let animationCurve: AnimationCurve = .easeOut
    }
    
    // MARK: - 枚举定义
    
    enum DataType {
        case menuItems
        case coupons
        case userProfile
        case orders
        case settings
    }
    
    enum ComponentType {
        case socialMedia
        case analytics
        case notifications
        case biometrics
        case locationServices
    }
    
    enum AnimationCurve {
        case linear
        case easeIn
        case easeOut
        case easeInOut
        case spring
    }
    
    // MARK: - 性能监控配置
    
    /// 是否启用启动性能监控
    static let enablePerformanceMonitoring: Bool = false
    
    /// 性能监控阈值（秒）
    static let performanceThreshold: TimeInterval = 1.0
    
    /// 是否记录启动时间日志
    static let logLaunchTime: Bool = false
}